-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(feedback): fix patching flakes with test_openai.py #95577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever you set an attr you have to unset otherwise the state of the application is mutated and it persists for the next test.
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #95577 +/- ##
==========================================
- Coverage 80.82% 80.82% -0.01%
==========================================
Files 10547 10547
Lines 607945 607965 +20
Branches 23825 23825
==========================================
+ Hits 491384 491394 +10
- Misses 115852 115862 +10
Partials 709 709 |
ah good to know, what if it's done in a fixture like |
wow, I was facing this exact issue when I was trying to test feedback summaries - thanks for cleaning it up |
#95392) User reports are the same product as feedback and owned by replay team. I'd like to move the code here for organizational purposes. Same goes for the feedback summary endpoint. This PR only moves things around, no implementation changes. Ref [REPLAY-513: \[PR Tracker\] refactor backend user feedback code](https://linear.app/getsentry/issue/REPLAY-513/pr-tracker-refactor-backend-user-feedback-code) I plan to follow up with quality improvements to the ingest functions, making them more composable, so that module's subject to change. Also fixes a flaky test `test_openai` described in #95577
Discovered in #95392 the monkeypatching of `OpenAI` class in `test_create_feedback.py` can affect `test_openai.py`, I'm guessing when they are ran in parallel. I haven't seen this flake anywhere else, but don't believe it's related to the changes in #95392. Using the patch context manager should fix this. "not spam" return value bleeds over to the openai test: <img width="806" height="476" alt="Screenshot 2025-07-15 at 10 51 22 AM" src="https://github.com/user-attachments/assets/d900d7d1-9138-422f-b354-ac94fad9967a" /> Ref [REPLAY-513: [PR Tracker] refactor backend user feedback code](https://linear.app/getsentry/issue/REPLAY-513/pr-tracker-refactor-backend-user-feedback-code)
Discovered in #95392 the monkeypatching of
OpenAI
class intest_create_feedback.py
can affecttest_openai.py
, I'm guessing when they are ran in parallel. I haven't seen this flake anywhere else, but don't believe it's related to the changes in #95392. Using the patch context manager should fix this."not spam" return value bleeds over to the openai test:

Ref REPLAY-513: [PR Tracker] refactor backend user feedback code